﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BPMS.Core.Builders
{
    public class SqlBuilderFactory
    {
        public static BuilderBase CreateBuilder<TEntity>(BuilderType builder = BuilderType.Select) where TEntity : EntityBase
        {
            Type entityType = typeof(TEntity);
            switch (builder)
            {
                case BuilderType.Delete:
                    return new DeleteStatementBuilder(entityType);
                case BuilderType.Update:
                    return new UpdateStatementBuilder(entityType);
                case BuilderType.Insert:
                    return new InsertStatementBuilder(entityType);
                case BuilderType.Select:
                    return new SelectStatementBuilder(entityType);
            }
            return new SelectStatementBuilder(entityType);
        }

        public static BuilderBase CreateBuilder<TEntity>(object setClause) where TEntity : EntityBase
        {
            return new UpdateStatementBuilder(typeof(TEntity), setClause);
        }
    }
}
